package com.tmsb.bigscreen.controller;

import com.tmsb.bigscreen.service.BigScreenService;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *Description:
 *Version:1.0.0
 *@author shihb
 *@date 2020/6/25 9:00
 */
@RestController
@RequestMapping(value = "/")
public class BigScreenController {
  @Autowired
  BigScreenService bigScreenService;
  @GetMapping("/order/sumList")
  public List getOrderMemory() {
    try {
      return bigScreenService.getSumList();
    } catch (Exception e) {
      e.printStackTrace();
      return new ArrayList();
    }
  }
  @GetMapping("/top/goods/{cap}")
  public List getTopGoods(@PathVariable("cap") int cap) {
    return bigScreenService.getTopGoods(cap);
  }
  @GetMapping("/top/sellers/{cap}")
  public List getTopSellers(@PathVariable("cap") int cap) {
    return bigScreenService.getTopSellers(cap);
  }
  @GetMapping("/order/his")
  public Map getHisSales() {
    return bigScreenService.getHisSales();
  }
  @GetMapping("/top/provinces/dau")
  public List getTopProvincesDau() {
    return bigScreenService.getActiveUsers();
  }

  @GetMapping("/order/details")
  public List getSalesDetails() {
    return bigScreenService.getSalesDetails();
  }

}
